package com.fsj.miniapp.api;

import com.fsj.miniapp.service.BannerService;
import com.fsj.miniapp.service.NoticeService;
import com.fsj.miniapp.vo.BannerVo;
import com.fsj.miniapp.vo.Json;
import com.fsj.miniapp.vo.NoticeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/notice")
public class NoticeController {

    @Autowired
    private NoticeService noticeService;

    @PostMapping("list")
    public Json list(@RequestParam(required = false,name = "pageSize") int pageSize , @RequestParam(required = false,name = "merchantId") Long merchantId) {
        List<NoticeVo> noticeVo = noticeService.listFor(merchantId,pageSize);
        Map<String, List<NoticeVo>> maps = new HashMap<>();
        maps.put("dataList", noticeVo);
        return Json.succ("notice list").data("data", maps);

    }
}
